import requests,threading,time

i=0
mlock=threading.Lock()
def res():
    global i
    try:

        r=requests.get('http://www.gaodun.com/')
    except Exception,e:
        pass
    finally:
        mlock.acquire()
        print i

        i+=1
        mlock.release()
    return i

first_time=time.time()
for i in xrange(0,2000):
    th=threading.Thread(target=res)
    th.start()

now_time=time.time()
print 'start:'+str(first_time)
print 'end:'+str(now_time)
print now_time-first_time